CREATE PROCEDURE dbo.EditorSelectModel
	@EditorKey INT = NULL,
	@UserName NVARCHAR(50) = NULL,
	@EmailAddress NVARCHAR(254) = NULL,
	@Audit_UserKey INT	
AS
	SET NOCOUNT ON

	IF (@EditorKey IS NULL AND @UserName IS NULL AND @EmailAddress IS NULL) BEGIN
		RAISERROR ('One of @EditorKey, @UserName, @EmailAddress must be non-null.', 15, 0)
		RETURN
	END

	SELECT 
		EditorKey,
		UserName,
		FirstName,
		LastName,
		EmailAddress,
		PasswordSalt,
		PasswordHash,
		IsEnabled
	FROM dbo.Editor
	WHERE 
		(UserName = @UserName) OR
		(EditorKey = @EditorKey) OR
		(EmailAddress = @EmailAddress)

RETURN 0
